import requests

url = "https://www.baidu.com"

headers = {
    "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1",
}

# 发送请求，获取resposne
r = requests.get(url, headers=headers)

# print(r.request.headers)
# print(r.headers.get("Set-Cookie"))

# print("打印响应头信息------开始-------")

# print(r.headers)
#
print("打印处理的cookie------开始-------")
# print(type(r.cookies))
print(r.cookies)
#
# # 使用方法从cookiejar中提取数据
cookies = requests.utils.dict_from_cookiejar(r.cookies)
print(cookies)

# print(cookies.keys())
